import axios from 'axios';
import { ElMessage } from 'element-plus'
const http = axios.create({
  baseURL: '/api',
  timeout: 30000,
});

http.interceptors.request.use(
  config => {
    
    return config;
  },
  error => {
    ElMessage.error('请求异常')
    return Promise.reject(error);
  }
);

http.interceptors.response.use(
  response => {
    return Promise.resolve(response);
  },
  error => {
    ElMessage.error('服务器异常')
    return Promise.reject(error);
  }
);

export default http;